package io.github.yuazer.pokecommandpro;

import io.github.yuazer.pokecommandpro.Commands.commands;
import io.github.yuazer.pokecommandpro.Listener.PokemonEvent;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {

    private static Main instance;

    public static Main getInstance() {
        return instance;
    }
    public void checkClass() throws ClassNotFoundException {
        Class.forName("com.pixelmonmod.pixelmon.Pixelmon");
    }
    @Override
    public void onEnable(){
        try {
            checkClass();
        } catch (ClassNotFoundException e) {
            System.out.println("§c未检测到宝可梦模组，插件已卸载，请检测服务端模组！");
            Bukkit.getPluginManager().disablePlugin(this);
        }
        instance = this;
        saveDefaultConfig();
        Bukkit.getPluginManager().registerEvents(new PokemonEvent(),this);
        Bukkit.getPluginCommand("pokecommandpro").setExecutor(new commands());
        this.getLogger().info("§aPokeCommandPro[1.16.5]");
        this.getLogger().info("§3状态-    §a已加载");
        this.getLogger().info("§3作者-    §bZ菌:QQ[1109132]");
        this.getLogger().info("§3版本-    §6" + this.getDescription().getVersion());
    }
    @Override
    public void onDisable(){
        this.getLogger().info("§e[PokeCommandPro] §a已经卸载");
    }
}
